<template>
  <div>
    <Box>
      <div slot="box" style="display: flex;justify-content: space-between;">
        <div>
          <h2>{{this.getdata.caseEventName}}</h2>
          <div>
            <div>
              <span>发生日期：{{this.getdata.happenDate}}</span>
              &emsp;&emsp;&emsp;
              <span>发生地：{{this.getdata.placeOccurrence}}</span>
              &emsp;&emsp;&emsp;
              <span>发生地详址：{{this.getdata.detailedAddress}}</span>
              &emsp;&emsp;&emsp;
              <span>事件分级：</span>
              <span :style="this.getdata.level == '04' ? 'color: green;' : 'color:red;' ">{{this.filterMultiDictText('cases_level',this.getdata.level)}}</span>
              &emsp;&emsp;&emsp;
              <span>事件类型：{{this.filterMultiDictText('cases_type',this.getdata.type)}}</span>
            </div>
          </div>
        </div>
        <div style="display: flex;align-items: center;">
          <div><span>状态:</span><span :style="this.getdata.state == '已完结' ? 'color: #888888;' : 'color: blue;' ">{{this.getdata.state}}</span></div>
          <div style="margin-left: 15px"><a-button>事件分派</a-button></div>
          <div style="margin-left: 15px"><a-button>启动预案</a-button></div>
          <div style="margin-left: 15px"><a-button type="primary" @click="jieshu">任务结束</a-button></div>
          <div style="margin-left: 15px"><a-button icon="printer">打印</a-button></div>
        </div>
      </div>
    </Box>
    <Box>
      <h2 style="margin: 10px 15px" slot="title">事件概述</h2>
      <div slot="box">
        <p style="font-size: 1.1rem">{{this.getdata.situation}}</p>
      </div>
    </Box>
    <div>
      <a-modal v-model="visible" title="详细信息" @ok="handleOk" width="600px" centered>
        <a-textarea
          v-model="input"
          placeholder="案事件总结"
          :auto-size="{ minRows: 3, maxRows: 5 }"
        />
      </a-modal>
    </div>
  </div>
</template>

<script>
import Box from '@views/xlgc/Box'
// import {getZDdetailed} from '@api/xlgc/lawCase'
import { getDictItemsFromCache } from '@api/api'

export default {
  name: 'detailed',
  components: { Box },
  data(){
    return {
      input:'',
      visible:false,
      getdata:{}
    }
  },
  mounted() {
    // this.institution(this.$route.query.id)
  },
  methods:{
    jieshu(){
      this.visible = true
    },
    handleOk(e) {
      console.log(e);
      this.visible = false;
    },
    institution(val){
      return new Promise((resolve,reject) => {
        getZDdetailed(val).then(response => {
          this.getdata = response.result
          resolve(response)
          console.log(response)
        }).catch(error => {
          reject(error)
        })
      })

    },
    filterMultiDictText(dictCode, text) {
      console.log(dictCode,text)
      if (!text && text !== 0) return
      let datas = getDictItemsFromCache(dictCode)
      // return this.$filterMultiDictText(datas, text)
      return this.$filterDictText(datas, text)
    }
  }
}
</script>

<style scoped>

</style>